Kameleon-Plus  0.3.2
CDFFileReader.h
Go to the documentation of this file.
1 /*
2  * FileReader.h
3  *
4  * Created on: Apr 22, 2009
5  * Author: David Berrios
6  */
7 
8 #ifndef CDFFILEREADER_H_
9 #define CDFFILEREADER_H_
10 #include <string>
11 #include <vector>
12 #include <iostream>
13 #include "Attribute.h"
14 #include <boost/unordered_map.hpp>
15 #include "cdf.h"
16 #include "FileReader.h"
17 
18 
19 
20 
21 
22 namespace ccmc
23 {
24 
25 
33  class CDFFileReader : public FileReader
34  {
35 
36  private:
37  std::string current_filename;
38  CDFid current_file_id;
39 
40  public:
41 
42  CDFFileReader();
43  std::vector<float>* getVariable(const std::string& variable);
44  std::vector<float>* getVariable(long variableID);
45  std::vector<float>* getVariable(const std::string& variable, long startIndex, long count);
46  std::vector<float>* getVariable(long variableID, long startIndex, long count);
47  float getVariableAtIndex(const std::string& variable, long index);
48  float getVariableAtIndex(long variable_id, long index);
49  std::vector<int>* getVariableInt(const std::string& variable);
50  int getVariableIntAtIndex(const std::string& variable, long index);
54  long getNumberOfRecords(const std::string& variable);
55  long getNumberOfRecords(long variable_id);
56  long getVariableID(const std::string& variable);
57  std::string getVariableName(long variable_id);
59  std::string getGlobalAttributeName(long attribute_id);
60  std::string getVariableAttributeName(long attribute_id);
61  Attribute getGlobalAttribute(const std::string& attribute);
62  long getGlobalAttributeID(const std::string& attribute);
63  Attribute getVariableAttribute(const std::string& variable, const std::string& attribute);
64  std::vector<std::string> getVariableAttributeNames();
65  bool doesAttributeExist(const std::string& attribute);
66  bool doesVariableExist(const std::string& variable);
67  bool doesAttributeExist(long attribute);
68  bool doesVariableExist(long variable);
69  const std::string& getCurrentFilename();
70  virtual ~CDFFileReader();
71 
72 
73  protected:
74 
75 
76  long closeFile();
77  long openFile(const std::string& filename, bool readonly = true);
80  void initializeVariableIDs();
82 
83  };
84 }
85 
86 #endif /* CDFFILEREADER_H_ */